package Application.Util;

import Application.Config.Config;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.image.BufferedImage;
import java.io.IOException;

public class FrameUtil {
    //工具类最好将构造器私有化
    private FrameUtil() {
    }

    /**
     * 返回指定路径文件的图片对象
     **/
    public static ImageIcon getImage() {
        BufferedImage bi = null;
        try {
            Config config = Config.configReader();
            bi = ImageIO.read(config.background_file);
        }catch(IOException e) {
            e.printStackTrace();
        }
        ImageIcon icon = new ImageIcon(bi);
        return icon;
    }
}
